﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using WeiboPlus.Service;
using Hammock.Authentication.OAuth;

namespace WeiboPlus.Twitter
{
    public class TwitterOAuthService : OAuthServiceBase
    {
        public TwitterOAuthService()
        {
            Provider = TwitterSNSProviderFactory.Instance.GetProvider();
        }

        protected override Hammock.Authentication.IWebCredentials CreateCredentials(OAuthType type)
        {
            var credentials = base.CreateCredentials(type) as OAuthCredentials;

            if (credentials != null)
            {
                switch (type)
                {
                    case OAuthType.RequestToken:
                        credentials.ParameterHandling = OAuthParameterHandling.UrlOrPostParameters;
                        credentials.CallbackUrl = "null";
                        break;
                    case OAuthType.AccessToken:
                        credentials.ParameterHandling = OAuthParameterHandling.UrlOrPostParameters;
                        break;
                    default:
                        break;
                }
            }

            return credentials;
        }
    }
}
